package cn.baage.campus.config;

import cn.baage.campus.config.properties.MinioProperties;
import io.minio.MinioClient;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Description: Minio 配置
 * @Author: 八阿哥
 * @url: baage.cn
 * @Version: 1.0
 **/
@Configuration
@RequiredArgsConstructor(onConstructor_ = @Autowired)
public class MinioConfig {

    private final MinioProperties minioProperties;
    @Bean
    public MinioClient minioClient() {
        // 构建 Minio 客户端
        return MinioClient.builder()
                .endpoint(minioProperties.getEndpoint())
                .credentials(minioProperties.getAccessKey(), minioProperties.getSecretKey())
                .build();
    }
}